@extends('admin::layouts.master')

@section('title')用户管理@endsection

@section('css')

@endsection

@section('nav')
    <div class="row mb-2">
        <div class="col-sm-6">
            <h1 class="m-0">用户管理</h1>
        </div>
        <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
                <li class="breadcrumb-item"><a href="{{route('admin.user')}}">用户管理</a></li>
                <li class="breadcrumb-item active">角色分配</li>
            </ol>
        </div>
    </div>

@endsection

@section('content')
    <div class="card">
        <div class="card-header">
            角色分配
        </div>
        <div class="card-body">
            <form class="form-horizontal" action="{{route('admin.user.assignRole',['id'=>$user->id])}}"
                  method="POST">
                <div class="form-group">
                    <label>用户名:</label>
                    <span>{{$user->username}}</span>
                </div>

                <div class="form-group">
                    <label>昵称:</label>
                    <span>{{$user->nickname}}</span>
                </div>
                <hr>
                <div class="form-group">
                    <span>可选角色(可多选):</span>
                    @foreach($roles as $role)
                    <div class="form-check-inline">
                        <input style="margin-left: 14px;" type="checkbox" name="roles[]" id="{{$role->name}}" value="{{$role->id}}" {{$role->own ?'checked':''}}>
                        <label for="{{$role->name}}" class="form-check-label" style="margin-left: 4px;">{{$role->display_name}}</label>
                    </div>
                    @endforeach
                </div>


                {{method_field('put')}}
                {{csrf_field()}}

                <div class="layui-form-item">
                    <label for="" class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <button type="submit" class="btn btn-dark">确 认</button>
                        <a href="{{route('admin.user')}}" class="btn btn-default">返 回</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection

@section('js')
    <script>

    </script>
@endsection